package com.leyou.item.service;

import com.leyou.common.vo.PageResult;
import com.leyou.item.dto.SpuDTO;
import com.leyou.item.dto.SpuDetailDTO;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by IntelliJ IDEA.
 *
 * @author: wangzibeng
 * Date: 2019/5/4 0004
 * Time: 21:17
 */
@Transactional
public interface SpuService {
    /**
     * 分页查询Spu
     *
     * @param key      搜索字
     * @param saleable 是否上架
     * @param page     当前页
     * @param rows     每页大小
     * @return
     */
    PageResult<SpuDTO> querySpuByPage(String key, Boolean saleable, int page, int rows);

    /**
     * 查询SpuDetail通过Id
     * 用于修改前商品的回显
     *
     * @param spuId
     * @return
     */
    SpuDetailDTO spuDetailById(Long spuId);

    /**
     * 下架商品 根据spuId
     * 更改sku spu
     *
     * @param id,
     * @param saleable
     */
    void spuSaleableById(Long id, Boolean saleable);

    /**
     * 删除商品
     *
     * @param id
     */
    void deleteSpuById(Long id);

    /**
     * 查询Spu
     *
     * @param id
     * @return
     */
    SpuDTO querySpuById(Long id);
}
